<template>
  <div>
    <el-row class="bgc" />
    <el-row class="fixed">
      <el-col :offset="3" :span="14">
        <el-menu
          :default-active="activeIndex"
          mode="horizontal"
          background-color="#545c64"

          text-color="#fff"
          active-text-color="#09C5FE"
          router
        >
          <el-menu-item index="/">首页</el-menu-item>
          <el-menu-item index="/rank">排名</el-menu-item>
          <el-menu-item index="/realtimeStatus">动态</el-menu-item>
        </el-menu>
      </el-col>
      <el-col :span="4" style="margin-left: 30px">
        <nav-enter />
      </el-col>
    </el-row>
  </div>
</template>

<script>
import NavEnter from '@/components/NavEnter'

export default {
  name: 'AcmHeader',
  components: { NavEnter },
  data() {
    return {
      activeIndex: '/',
      paths: ['/', '/rank', '/realtimeStatus']
    }
  },
  computed: {
    path() {
      return this.$route.path
    }
  },
  watch: {
    path(val) {
      const index = this.paths.findIndex(item => item === val)
      if (index === -1) this.activeIndex = null
      else this.activeIndex = val
    }
  },
  methods: {}
}
</script>

<style scoped>
  .el-menu-item {
    font-size: 18px !important;
    padding: 0 30px;
  }

  .fixed {
    position: fixed;
    z-index: 1000;
    margin: 0;
    width: 100%;
  }

  .bgc {
    position: fixed;
    top: 0;
    margin: 0;
    z-index: 999;
    background-color: #545c64;
    height: 61px;
    width: 100%;
    border-bottom: 1px solid #e6e6e6;
  }
</style>
